package com.dnzx.controller.admin;

import java.util.List;

import javax.annotation.Resource;

import org.dnzx.framework.page.PageResult;
import org.dnzx.framework.result.ResultUtils;
import org.dnzx.framework.result.domain.Result;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dnzx.model.MemberBO;
import com.dnzx.service.IMemberService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@RestController
@RequestMapping("/member")
@Api(value = "/member",description="会员信息管理",produces=MediaType.APPLICATION_JSON_VALUE)
public class MemberController {
	
	@Resource
	private IMemberService memberService;
	
	/**
	 * 查询 - 分页
	 * @param memberBO
	 * @return
	 */
	@PostMapping("/queryPage")
	@ApiOperation(value="/queryPage",notes="查询 - 分页：",httpMethod="POST",produces=MediaType.APPLICATION_JSON_VALUE)
	public Result queryPage(@ApiParam(value = "实体") @RequestBody MemberBO memberBO) {
		try {
			PageResult<List<MemberBO>> pageResult = new PageResult<List<MemberBO>>();
			pageResult = this.memberService.queryPage(memberBO, pageResult);
			return ResultUtils.returnSuccess("SUCCESS", pageResult);
		}catch(Exception e) {
			e.printStackTrace();
			return ResultUtils.returnError("ERROR >>> " + e.getMessage());
		}
	}
	
}
